#!/bin/sh


echo "Start Load Images"
docker load -i simple_updater_dev.tar
if [ $? -ne 0 ]; then
    exit
fi

echo "Start Stop Old Version"
docker update --restart=no $(docker ps | grep simple_updater_dev | awk '{print $1}')
if [ $? -ne 0 ]; then
    exit
fi
# TODO Is Neet compose arg Here?
docker stop $(docker ps | grep simple_updater_dev | awk '{print $1}')
if [ $? -ne 0 ]; then
    exit
fi

echo "Start Launch New Version"
docker compose -p simple_updater_dev_VERSION_ID up -d
if [ $? -eq 0 ]; then
    echo "Successful!"
fi

